package goodbaby.dklt.fragment;

import com.classic.core.fragment.BaseFragment;

/**
 * Created by Li.z on 2016/5/2.
 */
public abstract class HealthBaseFragment extends BaseFragment {
    private boolean shouldLoadData = true;


    public abstract void loadData();

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if(isVisibleToUser){
            toLoadData();
        }
    }

    public void toLoadData(){
        if(shouldLoadData){
            shouldLoadData = false;
            loadData();
        }
    }

    public void resetLoadDataState(){
        shouldLoadData = true;
    }
}
